package com.wenyu.wenyuyuedu.adapter.circleAdapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.wenyu.wenyuyuedu.R;

import java.util.List;

/**
 * Created by Administrator on 2017/3/9.
 * 书圈--我的详情页中内容图片的adapter
 */

public class MyCircleDetailGridView extends BaseAdapter {
    private Context context;
    private List<String> images;
    private View view;
    public int position;
    public MyCircleDetailGridView(Context context, List<String> images,int position){
        this.context = context;
        this.images = images;
        this.position = position;
    }
    @Override
    public int getCount() {
        return images.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        MyViewHolder holder = null;
        if(view != null){
            return view;
        }
        if(view == null){
            holder = new MyViewHolder();
            view = View.inflate(context, R.layout.my_circle_detail_gridview_item, null);
            holder.iv_gv_item = (ImageView)view.findViewById(R.id.iv_gv_item);
            view.setTag(holder);
        }
        holder = (MyViewHolder) view.getTag();
        String s = images.get(i);
        Glide.with(context)
                .load(images.get(i))
                .error(R.drawable.nomal_dynamic)
                .into(holder.iv_gv_item);
        return view;
    }
    class MyViewHolder{
        ImageView iv_gv_item;
    }
}
